package com.bw.flume.utils;

import com.alibaba.fastjson.JSONObject;

public class JSONUtils {
    public static void main(String[] args) {

        String sgtr="{\"common\":{\"ar\":\"22\",\"ba\":\"iPhone\",\"ch\":\"Appstore\",\"is_new\"" +
                ":\"0\",\"md\":\"iPhone Xs\",\"mid\":\"mid_401\",\"os\":\"iOS 13.3.1\",\"sc\"" +
                ":\"1\",\"sid\":\"24d7a9e5-74bd-49a5-8490-b712fe0a69d7\",\"uid\":\"161\",\"vc" +
                "\":\"v2.1.134\"},\"displays\":[{\"display_type\":\"promotion\",\"item\":\"8\"" +
                ",\"item_type\":\"course_id\",\"order\":1,\"pos_id\":3},{\"display_type\":\"" +
                "recommend\",\"item\":\"8\",\"item_type\":\"course_id\",\"order\":2,\"pos_id\"" +
                ":3},{\"display_type\":\"promotion\",\"item\":\"7\",\"item_type\":\"course_id" +
                "\",\"order\":3,\"pos_id\":3},{\"display_type\":\"promotion\",\"item\":\"3\",\"" +
                "item_type\":\"course_id\",\"order\":4,\"pos_id\":4},{\"display_type\":\"query\"" +
                ",\"item\":\"7\",\"item_type\":\"course_id\",\"order\":5,\"pos_id\":1},{\"displ" +
                "ay_type\":\"promotion\",\"item\":\"1\",\"item_type\":\"course_id\",\"order\":6," +
                "\"pos_id\":2},{\"display_type\":\"promotion\",\"item\":\"2\",\"item_type\":\"co" +
                "urse_id\",\"order\":7,\"pos_id\":2},{\"display_type\":\"query\",\"item\":\"1\"," +
                "\"item_type\":\"course_id\",\"order\":8,\"pos_id\":2},{\"display_type\":\"promo" +
                "tion\",\"item\":\"5\",\"item_type\":\"course_id\",\"order\":9,\"pos_id\":4}],\"" +
                "page\":{\"during_time\":690938,\"extend1\":\"108\",\"item\":\"21003\",\"item_ty" +
                "pe\":\"chapter_id\",\"last_page_id\":\"course_detail\"," +
                "\"page_id\":\"chapter_video\"},\"ts\":1747989349538}\n";
        System.out.println(isJSON(sgtr));

    }

    public static Boolean isJSON(String str){
      try {
          JSONObject jsonObject1 = JSONObject.parseObject(str);
          return true;
      }catch (Exception e){
          return false;
      }

    }
}
